package com.ihr360.commons.model.type;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ihr360.commons.model.annotation.EnumData;
import com.ihr360.commons.serializer.jackson.EnumDataSerializer;

@EnumData
@JsonSerialize(using = EnumDataSerializer.class)
public enum SalaryAdjustFormula {
    FORMULA0("不启用", ""),

    FORMULA1("差额工资 * 调整前计薪天数 / 月标准计薪天数", "=(PHASE2!$SAL_ADJUST_RULE$calcBase-PHASE1!$SAL_ADJUST_RULE$calcBase)*PHASE2!ATT_M_R$paiddays/$SAL_ADJUST_RULE$monthWorkCount"),
    FORMULA2(" 差额工资 * ( 月标准计薪天数 - 调整前计薪天数 ) / 月标准计薪天数", "=(PHASE2!$SAL_ADJUST_RULE$calcBase-PHASE1!$SAL_ADJUST_RULE$calcBase)*($SAL_ADJUST_RULE$monthWorkCount-PHASE2!ATT_M_R$paiddays)/$SAL_ADJUST_RULE$monthWorkCount");

    SalaryAdjustFormula(String title, String formula) {
        this.title = title;
        this.formula = formula;
    }

    @JsonCreator
    public static SalaryAdjustFormula factory(@JsonProperty(value = "id") String id) {
        return SalaryAdjustFormula.valueOf(id);
    }

    private String title;

    private String formula;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getFormula() {
        return formula;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }
}
